﻿//   StorageKey.cs
//   Copyright (c) 2012 Eswar Prakash
// 
//    This library is free software; you can redistribute it and/or modify  
//    it  under the terms of the GNU Lesser General Public License version  
//    2.1 as published by the Free Software Foundation.                     
//                                                                          
//    This library is distributed in the hope that it will be useful, but   
//    WITHOUT ANY WARRANTY; without even the implied warranty of            
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     
//    Lesser General Public License for more details.                       
//                                                                          
//    You should have received a copy of the GNU Lesser General Public      
//    License along with this library; if not, write to the Free Software   
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
//    USA
namespace CKSAS.AppStorage.SharedService
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.Serialization;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;

    /// <summary>
    /// Represents a storage partition for a storage item in the storage database
    /// </summary>
    [DataContract(Name = "StoragePartition", Namespace = "http://schemas.cksas.org/contracts/")]
    internal class StoragePartition
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="StoragePartition"/> class. Used for serialization
        /// purposes only
        /// </summary>
        public StoragePartition()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="StoragePartition"/> class.
        /// </summary>
        /// <param name="webApplication">The SharePoint web application for which this object is stored.</param>
        internal StoragePartition(SPWebApplication webApplication)
        {
            this.WebApplicationId = webApplication.Id;
        }

        /// <summary>
        /// Gets or sets the unique identifier of the SharePoint web application that this
        /// storage item is associated with
        /// </summary>
        [DataMember]
        public Guid WebApplicationId
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the unique identifier of the site that this storage item is associated
        /// with
        /// </summary>
        [DataMember]
        public Guid? SiteId
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the unique identifier of the SharePoint web that this storage item is associated
        /// with
        /// </summary>
        [DataMember]
        public Guid? WebId
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the unique identifier of the SharePoint list that this storage item is associated
        /// with
        /// </summary>
        [DataMember]
        public Guid? ListId
        {
            get;
            set;
        }
    }
}